package org.example.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.entity.Course;
import org.example.vo.CourseVo;

import java.util.List;

@Mapper
public interface CourseMapper {
    /**
     * 创建课程
     * @param course
     * @return
     */
    @Insert("insert into courses (course_name, course_description, instructor_id, course_time, teaching_method) " +
            "values (#{courseName}, #{courseDescription}, #{instructorId}, #{courseTime}, #{teachingMethod})")
    Boolean createCourse(Course course);


    /**
     * 获取所有课程
     * @return
     */
    @Select("select * from courses ")
    List<Course> getAllCourse();

    /**
     * 根据条件获取课程
     * @param courseVo
     * @return
     */
    List<Course> getCourseByCondition(CourseVo courseVo);

    /**
     * 完善课程信息
     * @param course
     * @return
     */
    Boolean updateCourseInfo(Course course);
}
